<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Dom</title>
  </head>
  <body>
    <div class="demo">
      <span class="demo">Hi I'm Loen!</span>
    </div>
    <p class="demo">This is a paraph</p>
    <script>
      var arr = document.getElementsByClassName('demo')
      // 访问第二个元素
      arr[i].innerHTML = 'Hi I am Peter'
    </script>
  </body>
</html>
